﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TreeMap
{
	public class Entry
	{
		public string[] CategoryValues { get; set; }
		public int Amount;

		public Entry(string[] CategoryValues)
		{
			this.CategoryValues = CategoryValues;
		}

		public override string ToString()
		{
			return string.Join(" ", CategoryValues) + " " + Amount;
		}

		public bool HasSameCategories(string[] categories)
		{
			if (CategoryValues.Length == categories.Length)
			{
				for (int i = 0; i < CategoryValues.Length; i++)
				{
					if (CategoryValues[i] != categories[i])
					{
						return false;
					}
				}
				return true;
			}
			return false;
		}

		public bool MatchesCategories(string[] categories)
		{
			for (int i = 0; i < categories.Length; i++)
			{
				if (!string.IsNullOrEmpty(categories[i]) && categories[i] != this.CategoryValues[i])
				{
					return false;
				}
			}
			return true;
		}
	}
}
